package com.yzs.exam.repository;

import com.yzs.exam.entity.ExamPaper;
import com.yzs.exam.entity.other.KeyValue;
import com.yzs.exam.viewmodel.admin.exam.ExamPaperPageRequestVM;
import com.yzs.exam.viewmodel.student.dashboard.PaperFilter;
import com.yzs.exam.viewmodel.student.dashboard.PaperInfo;
import com.yzs.exam.viewmodel.student.exam.ExamPaperPageVM;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.Date;
import java.util.List;

/**
 * @author yzs
 * @create 2021-03-26 15:09
 */
@Repository
@Mapper
public interface ExamPaperMapper extends BaseMapper<ExamPaper> {
    int deleteByPrimaryKey(Integer id);

    int insert(ExamPaper record);

    int insertSelective(ExamPaper record);

    ExamPaper selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(ExamPaper record);

    int updateByPrimaryKey(ExamPaper record);

    /**
     * 试卷vo页对象
     * @param requestVM
     * @return
     */
    List<ExamPaper> page(ExamPaperPageRequestVM requestVM);

    /**
     * 任务试卷vo页对象
     * @param requestVM
     * @return
     */
    List<ExamPaper> taskExamPage(ExamPaperPageRequestVM requestVM);

    /**
     * 学生考试vo页对象
     * @param requestVM
     * @return
     */
    List<ExamPaper> studentPage(ExamPaperPageVM requestVM);

    List<PaperInfo> indexPaper(PaperFilter paperFilter);

    Integer selectAllCount();

    List<KeyValue> selectCountByDate(@Param("startTime") Date startTime, @Param("endTime") Date endTime);

    int updateTaskPaper(@Param("taskId") Integer taskId,@Param("paperIds") List<Integer> paperIds);

    int clearTaskPaper(@Param("paperIds") List<Integer> paperIds);

}
